package org.ch02.sk.demo02;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * @author XCH
 * @date 2025 - 03 - 19
 */
public class MainTest {
    public static void main(String[] args) throws Exception{
        List<String> list = new ArrayList<>();
        Class<?> clazz = list.getClass();
        Method add = clazz.getDeclaredMethod("add", Object.class);
        add.invoke(list,"张三");
        add.invoke(list,100);
        System.out.println(list);

    }
}
